package org.zuel.boot.demo.util;

import org.zuel.boot.demo.util.bcrypt.BCryptPasswordEncoder;

public class PasswordUtil {

    //比对加密密码, 前者为输入参数, 后者为数据库实际存储
    public static Boolean matchPwd(String password,String userPassword){
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        if(encoder.matches(password,userPassword)){
              return true;
        }
        return false;
    }

    public static String encode(String password) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        return encoder.encode(password);
    }
}
